package cn.com.bluemoon.daps.common.datascope.aop;

import cn.com.bluemoon.daps.common.datascope.AuthRole;
import cn.com.bluemoon.daps.common.domain.UserInfoHolder;
import cn.com.bluemoon.daps.common.exception.DapThrowException;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;

import javax.servlet.http.HttpServletRequest;

/**
 * 默认
 * 如果用户有该角色就放行
 *
 * @author Jarod.Kong
 */
@Slf4j
public class DefaultAuthAccessService implements AuthAccessService {
    @Override
    public void checkAuth(UserInfoHolder.UserInfo userInfo, AuthRole authRole, boolean hasRoleAuth, ProceedingJoinPoint aspectPoint,
                          HttpServletRequest servletRequest) throws DapThrowException {
        assertHadRoleAuth(hasRoleAuth, authRole.errorMsg());
    }

}
